package Homework.apiDay01;

import java.util.Random;
import java.util.Scanner;

public class ApiDemo {
    public static void main(String[] args) {
        String line = "123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        Random random = new Random();
        Scanner sc = new Scanner(System.in);
        StringBuilder code = new StringBuilder("");
        String in="";
        for (int i=0;i<4;i++){
            char c = line.charAt(random.nextInt(line.length()));
            code.append(c);
        }
        System.out.println("验证码为:"+code);
        in += sc.nextLine();
        if(code.toString().equalsIgnoreCase(in)){
            System.out.println("验证成功!");
        }else{
            System.out.println("验证失败..");
        }

    }
}
